package com.zdsoft.wms.feign.fallback;

import com.zdsoft.wms.common.ServerResponse;
import com.zdsoft.wms.feign.UserFeignClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UserClientFallBackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        log.info(throwable.toString());
       return new UserFeignClient(){

           @Override
           public ServerResponse findAllBySerstationId(int serstationId) {
               return ServerResponse.createByErrorMessage("远程调用异常");
           }

           @Override
           public ServerResponse findInfoById(int id) {
               return ServerResponse.createByErrorMessage("远程调用异常");
           }
       };
    }
}
